#ifndef STANDARDSECTIONVIEW_H
#define STANDARDSECTIONVIEW_H

#include "abstract-section-view.h"

class QAbstractItemDelegate;
class QModelIndex;
class QSplitter;
class QVBoxLayout;
class AbstractDatabaseClient;
class AbstractSectionModel;
class AllowRemoveDataSettings;
class SectionDescendantView;
class SortFilterProxyModel;
class TableView;

class StandardSectionView : public AbstractSectionView
{
    Q_OBJECT
public:
    explicit StandardSectionView(QWidget *parent = 0);

    virtual bool canRemoveData();
    virtual QVariantList nextSectionParameters();

public slots:
    virtual void initialize();
    virtual void refresh();
    virtual void setDescendantViewEnabled (bool enabled);
    virtual void setFreezableTableViewEnabled (bool enabled);
    virtual void setDatabaseClientEnabled (bool enabled);
    virtual void addData();
    virtual void editData(bool);
    virtual void removeData();
    virtual void enterIntoData();
    virtual void exportData();
    virtual void openSettingsDialog();
    virtual void setDelegates();
    virtual void clearDelegates();

protected slots:
    virtual void continueInitialize();
    virtual void finishInitialize();
    virtual void removeDataFinished(int result);
    virtual void descendantViewItemActivated(GraphNode<SectionInfo> *sectionNode);
    virtual void tableViewItemActivated (const QModelIndex& index);
    virtual void changeAllowRemoveData(bool allowed);
    virtual void about();

protected:
    TableView* m_tableView;
    SectionDescendantView* m_sectionDescendantView;
    QToolBar* m_toolBar;
    QVBoxLayout* m_verticalLayout;
    QSplitter* m_splitter;
    AbstractSectionModel* m_sectionModel;
    SortFilterProxyModel* m_proxyModel;
    QAction* m_addDataAction;
    QAction* m_editDataAction;
    QAction* m_removeDataAction;
    QAction* m_enterIntoDataAction;
    bool m_sectionDescendantViewEnabled;
    bool m_tableViewEnabled;
    bool m_databaseClientEnabled;
    bool m_addDataEnabled;
    bool m_editDataEnabled;
    bool m_removeDataEnabled;
    QString m_addDataText;
    QString m_editDataText;
    QString m_removeDataText;
    QString m_enterIntoDataText;
    QString m_noRowSelectedError;
    QString m_currentIndexNotSelectedError;
    QString m_removeDataConfirmation;

private:
    QSharedPointer<AllowRemoveDataSettings> m_allowRemoveDataSettings;
};

#endif // STANDARDSECTIONVIEW_H
